amd iommu: Remove a useless flag and fix I/O page fault for hvm
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 7 Sep 2009 07:43:14 +0000 (08:43 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 7 Sep 2009 07:43:14 +0000 (08:43 +0100)
passthru devices.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
xen/drivers/passthrough/amd/iommu_map.c
xen/drivers/passthrough/iommu.c
xen/include/xen/hvm/iommu.h

index 9754f4b1ed386fdf815fd0271169ceaf64b1b41c..79f2e73cc6b66ea722326cbb6bc15829535c01e5 100644 (file)
@@ -459,9 +459,6 @@ int amd_iommu_map_page(struct domain *d, unsigned long gfn, unsigned long mfn)
 
     spin_lock(&hd->mapping_lock);
 
-    if ( is_hvm_domain(d) && !hd->p2m_synchronized )
-        goto out;
-
     iommu_l2e = iommu_l2e_from_pfn(hd->root_table, hd->paging_mode, gfn);
     if ( iommu_l2e == 0 )
     {
@@ -472,7 +469,6 @@ int amd_iommu_map_page(struct domain *d, unsigned long gfn, unsigned long mfn)
     }
     set_iommu_l1e_present(iommu_l2e, gfn, (u64)mfn << PAGE_SHIFT, iw, ir);
 
-out:
     spin_unlock(&hd->mapping_lock);
     return 0;
 }
@@ -488,12 +484,6 @@ int amd_iommu_unmap_page(struct domain *d, unsigned long gfn)
 
     spin_lock(&hd->mapping_lock);
 
-    if ( is_hvm_domain(d) && !hd->p2m_synchronized )
-    {
-        spin_unlock(&hd->mapping_lock);
-        return 0;
-    }
-
     iommu_l2e = iommu_l2e_from_pfn(hd->root_table, hd->paging_mode, gfn);
 
     if ( iommu_l2e == 0 )
index 6933e658fe9b319569b5b38d531b2f33721964b3..c6906871d78ae0254884407ca298de2a97e62ca0 100644 (file)
@@ -158,7 +158,8 @@ static int iommu_populate_page_table(struct domain *d)
 
     page_list_for_each ( page, &d->page_list )
     {
-        if ( (page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page )
+        if ( is_hvm_domain(d) ||
+            (page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page )
         {
             rc = hd->platform_ops->map_page(
                 d, mfn_to_gmfn(d, page_to_mfn(page)), page_to_mfn(page));
index 8ed453004434fb3195c66a24ca15fd43b98860a7..b72656ee577dcedf2a8a5f1fcc8e40822013e303 100644 (file)
@@ -41,7 +41,6 @@ struct hvm_iommu {
     int domain_id;
     int paging_mode;
     struct page_info *root_table;
-    bool_t p2m_synchronized;
 
     /* iommu_ops */
     struct iommu_ops *platform_ops;